Macros Property

Summary
Gets or sets the macros.
Syntax
C#
C++/CLI
public Dictionary<string, MacroSubstitutionDelegate<T>> Macros { get; set; } 
public: 
property Dictionary<String^,MacroSubsitutionDelegate<T^>^>^ Macros { 
   Dictionary<String^,MacroSubsitutionDelegate<T^>^>^ get(); 
   void set (    Dictionary<String^,MacroSubsitutionDelegate<T^>^>^ ); 
} 

Property Value

The list of macros and delegates to be called to process the macro.

Example

This example adds two macros to the macro processor and process a string.

C#
using Leadtools.Dicom.Common.Anonymization; 
 
 
public void MacroProcessorSample() 
{ 
   MacroProcessor<object> processor = new MacroProcessor<object>(); 
 
   // 
   // add two macros to the macro processor 
   // 
   processor.Macros.Add("current_date", new MacroSubstitutionDelegate<object>(CurrentDateMacro)); 
   processor.Macros.Add("current_time", new MacroSubstitutionDelegate<object>(CurrentTimeMacro)); 
 
   // 
   // Process a macro string 
   // 
   Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}")); 
} 
 
private string CurrentDateMacro(object userData, string name, params object[] parameters) 
{ 
   return DateTime.Now.ToShortDateString(); 
} 
 
private string CurrentTimeMacro(object userData, string name, params object[] parameters) 
{ 
   return DateTime.Now.ToShortTimeString(); 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Common Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.